import 'package:flutter/material.dart';
import 'package:geomancy/pages/calendar/almanac/index.dart';
import 'package:geomancy/pages/calendar/festival/index.dart';
import 'package:geomancy/pages/calendar/weather/index.dart';
import 'package:geomancy/pages/calendar/widgets/tab_bar.dart';
import 'package:geomancy/styles/index.dart';

class CalendarPage extends StatefulWidget {
  const CalendarPage({super.key});

  @override
  State<CalendarPage> createState() => _CalendarPageState();
}

class _CalendarPageState extends State<CalendarPage> with SingleTickerProviderStateMixin {
  List<String> tabs = ['实时天气', '黄历查询', '节日节气'];
  late TabController _controller;

  @override
  void initState() {
    super.initState();
    _controller = TabController(length: tabs.length, vsync: this);
  }


  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: ColorStyle.pageDefaultColor,
      body: SafeArea(
        bottom: false,
        child: Column(
          children: [
            CalendarTabBar(controller: _controller, tabs: tabs),
            Flexible(child: TabBarView(
              controller: _controller,
              children: const [
                CalendarWeatherPage(),
                CalendarAlmanacPage(),
                CalendarFestivalPage(),
              ],
            ))
          ],
        ),
      )
    );
  }
}
